﻿namespace LocalOverride.Fiddler.Store
{
    public class LocalPathValidator : IValidator
    {
        private readonly MappingEntry mappingEntry;
        private readonly ILocalFileAccess localFileAccess;

        public LocalPathValidator(MappingEntry mappingEntry, ILocalFileAccess localFileAccess)
        {
            this.mappingEntry = mappingEntry;
            this.localFileAccess = localFileAccess;
        }

        public ValidationResult Validate()
        {
            if (mappingEntry.IsDirectory)
            {
                return new DirectoryPathValidator(mappingEntry, localFileAccess).Validate();
            }
            else
            {
                return new FilePathValidator(mappingEntry, localFileAccess).Validate();
            }
        }
    }
}